import QtQuick
import QtQuick.Controls

Window {
    visible: true
    width: 400
    height: 400
    title: "一次性定时器"

    Button {
        text: "3秒后显示消息"
        onClicked: {
            timer.start()
            message.text = "计时开始..."
        }
    }

    Label {
        id: message
        anchors.centerIn: parent
    }

    Timer {
        id: timer
        interval: 3000 // 3秒
        onTriggered: message.text = "时间到！"
    }
}
